<?php
defined('IN_XLP') or exit('Access Denied');
$Document = array(
	'pageid'   => 'order-deliver', //页面标示
	'pagename' => '发货表单', //当前页面名称
	'mycss'	   => array(), //加载的css样式表
	'myjs'	   => array(), //加载的js脚本
	'footerjs' => array(),
	'head'	   => false, //加载头部文件
);
include getTpl('header', 'public');
?>
<style>.pt7{padding-top:7px;}</style>
<form style="width:600px;height:400px;" class="form-horizontal" method="post" id="processForm">
	<div class="form-group">
		<label class="col-sm-2 control-label">订单号</label>
		<div class="col-sm-5 pt7"><?php echo $order['order_sn']; ?></div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label">收货人</label>
		<div class="col-sm-5 pt7"><?php echo $order['recipients']; ?></div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label">订单商品</label>
		<div class="col-sm-5 pt7">
		<?php foreach ($order_goods as $k=>$v): ?>
		<?php echo '<'.($k+1).'>&emsp;'.$v['goods_name'].'&emsp;(x '.$v['goods_num'].'件)<br>'; ?>
		<?php endforeach ?>
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label">物流配送</label>
		<div class="col-sm-5 pt7">
			<select name="shipping_express_id" id="shipping_express_id">
			<?php foreach ($express as $v): ?>
			<option value="<?php echo $v['id']; ?>"><?php echo $v['e_name']; ?></option>
			<?php endforeach ?>
			</select>
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label">物流单号</label>
		<div class="col-sm-5">
			<input type="type" name="shipping_code" id="shipping_code" placeholder="若没有物流单号请不要填写" data-required="true" class="bg-focus form-control" />
			<div class="line line-dashed m-t-large"></div>
		</div>
	</div>
	<!-- <div class="form-group">
		<label class="col-sm-2 control-label">备注</label>
	</div> -->
	<div class="form-group">
		<div class="col-sm-9 col-lg-offset-2">
			<input type="hidden" name="order_id" value="<?php echo $order['id']; ?>">
			<div class="col-sm-1"><button type="submit" id="sub-ok" data-loading-text="正在提交..." class="btn btn-primary">保存</button></div>
			<button type="button" class="btn btn-white col-md-offset-2" onclick="self.location.reload();">取消</button>
		</div>
	</div>
</form>
<script>
$(function(){
	$('#processForm').submit(function(){
		var shipping_code = $.trim($('#shipping_code').val());
		// if(shipping_code==''){
		// 	Msg.error('请输入订单号');
		// 	resetSubmit("#sub-ok",'提交');
		// 	return false;
		// }
		Msg.loading();
		$.post('<?php echo U("order/deliver_form");?>',$(this).serialize(),function(result){
			Msg.hide();
			resetSubmit("#sub-ok",'提交');
			if(result.status==1){
				Msg.ok(result.info);
				self.location.reload();
			}else{
				Msg.error(result.info);
			}
		},'JSON');
		return false;
	});
});
</script>
</body>
</html>